package com.example.task1.ui.AllService.traffic;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.TrafficUndoBean;
import com.example.task1.ui.BaseAdapter;

import java.util.List;

public class TrafficUndoAdapter extends BaseAdapter<TrafficUndoBean.RowsDTO> {

    private List<TrafficUndoBean.RowsDTO> mData;
    private TextView tvReason;
    private TextView tvStatus;
    private TextView tvAuditRemark;
    private TextView tvTime;

    @Override
    protected void setData(List<TrafficUndoBean.RowsDTO> rows) {
        mData = rows;
        notifyDataSetChanged();
    }

    @Override
    protected int getLayout() {
        return R.layout.trafficundolayout;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<TrafficUndoBean.RowsDTO> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, TrafficUndoBean.RowsDTO date) {
        tvReason.setText(date.getReason());
        tvStatus.setText(date.getStatus());
        tvTime.setText("审批时间：" + date.getApplyDate());
        tvAuditRemark.setText("审批意见：" + date.getAuditRemark());
    }

    @Override
    protected void holder(View itemView) {
        initView(itemView);
    }

    private void initView(View view) {
        tvReason = (TextView) view.findViewById(R.id.tv_reason);
        tvStatus = (TextView) view.findViewById(R.id.tv_status);
        tvAuditRemark = (TextView) view.findViewById(R.id.tv_auditRemark);
        tvTime = (TextView) view.findViewById(R.id.tv_time);
    }
}
